﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Collections;
using System.Reflection;

namespace NCacheDServer
{
    [ServiceContract(Namespace = "urn:NCacheD")]
    [ServiceKnownType("GetKnownTypes", typeof(Helper))] 
    public interface ICacheServer
    {
        [OperationContract]
        byte[] Get(string key);

        [OperationContract(IsOneWay = true)]
        void Put(string key, DateTime expiration, byte[] value);

        [OperationContract(IsOneWay = true)]
        void Delete(string key);

        [OperationContract]
        long GetSize();

    }

    static class Helper
    {
        public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
        {
            return new List<Type> 
            { 
                typeof(byte[]),
                typeof(string),
                typeof(DateTime)

            };
        }
    } 

}
